package com.huawei.esdk.tp.device.smc.v100r003c10.convert;

import java.util.ArrayList;
import java.util.List;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.tp.domain.model.bean.OrganizationItem;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.QueryOraganizationResponse;

public class TPSMC20V1R3C10OrgaMgrConvert
{
    
    public SDKResult<List<OrganizationItem>> queryOrganizationSoap2model(QueryOraganizationResponse responseSouth)
    {
        SDKResult<List<OrganizationItem>> result = new SDKResult<List<OrganizationItem>>();
        if (null != responseSouth.getQueryOraganizationResult())
        {
            result.setErrCode(responseSouth.getQueryOraganizationResult().getErrCode());
        }
        
        if (0 == result.getErrCode() && null != responseSouth.getOrgs())
        {
            List<com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.OrganizationItem> orgaSouthResult =
                responseSouth.getOrgs().getOrganizationItem();
            List<OrganizationItem> orgasModal = new ArrayList<OrganizationItem>();
            result.setResult(orgasModal);
            for (com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.OrganizationItem item : orgaSouthResult)
            {
                OrganizationItem orgaModal = new OrganizationItem();
                orgaModal.setId(item.getId());
                orgaModal.setName(item.getName());
                orgasModal.add(orgaModal);
            }
        }
        
        return result;
    }
}
